story = {}
QMPlugin = story

function story.init()
    mlog.info("story init >>>>>>>>>>>")
end

-- 当前屏幕是否是剧情中
function story.check()
    local isExists = game.cmpColorEx(utils.unpack(define.store.flagArr))
    return isExists
end

function story.skipClick()
    game.tap(utils.unpack(define.store.skipCoord))
end

function story.waitEvent(timeOut)
    timeOut = timeOut or 10000
    local start = os.clock()
    local isExists = false
    while not isExists do
        isExists = story.check()
        if isExists == true then
            story.skipClick()
        else
            game.delay(500)
        end
        local execTime = (os.clock() - start) * 1000
        if execTime >= timeOut then
            mlog.info("【store wait】 time out >>>>>>>>>>>>>>>", timeOut)
            break
        end
    end

    return isExists
end

